package com.example.helloworld;

import static com.music.lib.MyGirl.*;

import java.lang.Exception;
import java.lang.RuntimeException;
import java.lang.String;
import java.lang.System;
import java.util.Date;

/**
 * Author: "Afra55"
 * Date: "2020.8.6"
 * Desc: "你说一，我说一，大家都来说一个"
 * Version: 1.0
 */
public final class HelloWorld {
  private final String greeting;

  private final String version = "Afra55-" + 1.0;

  public HelloWorld() {
    this.greeting = "90909";
  }

  public HelloWorld(String greeting) {
    this.greeting = greeting;
  }

  public static void main(String[] args) {
    System.out.println("Hello, JavaPoet!");
    int total = 0;
    for(int i = 0; i < 10; i++) {
      total += i;
    }
  }

  public int add(int number, int sub) {
    for(int i = 0; i < 10; i++) {
      number += i + sub;
    }
    if (number > 10) {
      number *= 20;
    } if (number > 5) {
      number -= 10;
    } else {
      System.out.println("Ok, time still moving forward \"$ @@");
      System.out.println("12345");
    }
    return number;
  }

  void catchMethod() {
    try {
      throw new Exception("Failed");
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }

  Date today() {
    return new Date();
  }

  Date tomorrow() {
    return new Date();
  }

  void staticTestMethod() {
    System.out.println(A);
  }

  char hexDigit(int i) {
    return (char) (i < 10 ? i + '0' : i - 10 + 'a');
  }

  String byteToHex(int b) {
    char[] result = new char[2];
    result[0] = hexDigit((b >>> 4) & 0xf);
    result[1] = hexDigit(b & 0xf);
    return new String(result);
  }
}
